/***********************************************************
 * Product Name: ExcelQuicker
 * Copyright (c)2005, Eunge
 * Author: Eunge
 * Web Site: www.eudev.net
 * Mail/MSN: eudev.net@yeah.net
 * ********************************************************/
using System;
using System.Collections;

namespace ExcelQuicker.Framework
{
	/// <summary>
	/// Style of row. We can set the style on specialized row
	/// </summary>
	public class EQRowStyle: EQRangeBase 
	{
		private EQDualCollection mRowsCollection = new EQDualCollection();

		/// <summary>
		/// Set style on specialized row. We can set diferent style object on same column, etc, EQBorderStyle, EQRangeStyle
		/// </summary>
		/// <param name="rowIndex"></param>
		/// <param name="objEQStyleBase"></param>
		public void SetRowStyle(int rowIndex, EQStyleBase objEQStyleBase)
		{
			EQKit.CheckPosition(rowIndex);
			this.mRowsCollection.Add(rowIndex, objEQStyleBase);
		}

		/// <summary>
		/// Remove all style
		/// </summary>
		public void RemoveRowStyle()
		{
			this.mRowsCollection.RemoveAll();
		}

		/// <summary>
		/// Output this object to excel document
		/// </summary>
		/// <param name="objWorksheet"></param>
		protected internal override void Output(Excel.Worksheet objWorksheet)
		{
			IEnumerator objIEnumerator = this.mRowsCollection.GetEnumerator();	//Go through all the column style
			while(objIEnumerator.MoveNext())
			{
				int index = (objIEnumerator.Current as EQDualValue).Key;
				EQStyleBase objEQStyleBase = (EQStyleBase)(objIEnumerator.Current as EQDualValue).Value;
				Excel.Range objRange = (Excel.Range)objWorksheet.Rows[index, this.Missing];
				objEQStyleBase.Output(objRange);
			}
		}
	}
}
